<template>
  <div class="mc-prompt">
    <ul class="mc-list" :class="direction === 'horizontal' ? 'mc-list-horizontal' : 'mc-list-vertical'">
      <li v-for="item in list" :key="item.value" class="mc-list-item" @click="$emit('itemClick', item)">
        <i v-if="item.iconConfig" :class="item.iconConfig.name" :style="{ color: item.iconConfig.color }"></i>
        <span class="mc-list-item-label">{{ item.label }}</span>
        <span v-if="item.desc" class="mc-list-item-desc">{{ item.desc }}</span>
      </li>
    </ul>
  </div>
</template>

<script setup lang="ts">
defineProps({
  list: {
    type: Array,
    default: () => [],
  },
  direction: {
    type: String,
    default: 'vertical',
  },
});

defineEmits(['itemClick']);
</script>

<style scoped>
.mc-prompt {
  width: 100%;
}

.mc-list {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 8px;
}

.mc-list-horizontal {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
}

.mc-list-vertical {
  flex-direction: column;
}

.mc-list-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 4px;
  background-color: var(--devui-area, #f8f8f8);
  cursor: pointer;
  transition: background-color 0.3s;
}

.mc-list-item:hover {
  background-color: var(--devui-list-item-hover-bg, #f2f5fc);
}

.mc-list-item i {
  margin-right: 8px;
}

.mc-list-item-label {
  font-size: 14px;
  color: var(--devui-text, #252b3a);
}

.mc-list-item-desc {
  margin-left: 8px;
  font-size: 12px;
  color: var(--devui-aide-text, #8a8e99);
}

.mc-list-vertical .mc-list-item {
  width: 100%;
}

.mc-list-horizontal .mc-list-item {
  flex: 0 0 auto;
}
</style> 